package slg;

import pixi.core.display.Container;
import pixi.core.textures.Texture;
import pixi.core.sprites.Sprite;
import pixi.core.text.DefaultStyle;
import pixi.core.text.Text;
import pixi.plugins.app.Application;

class Main extends Application {

	var _label1:Text;
	var _label2:Text;
	var _label3:Text;

	public function new() {
		super();
		_init();
	}

	function _init() {
		position = "fixed";
		backgroundColor = 0xFFFFFF;
		super.start();


		var style2 = {
			fontSize:52
		};



		var layer = new Container();
		this.stage.addChild(layer);

		var tex = Texture.fromImage("assets/slg/tiled/dibiao/mask.png");

		var width = 200;
		var height = 100;
		for(y in 0...6){
			for(x in 0...6){
				var tiled = new Sprite(tex);
				tiled.anchor.set(0.5);
				layer.addChild(tiled);

				tiled.tint = 0x0000FF;


				var tx = x * width / 2 + y * width / 2;
				var ty = y * height / 2 - x * height / 2;
//				var tx = (y - x)/2 * width * 0.5;
//				var ty = (x + y)/2 * height;

				tiled.position.set(tx, ty );


//				var lb = new Text("${x},${y}}");
//				lb.anchor.set(0.5);
//				lb.style.fill ="#99ff33";
//				lb.position.set(tx, ty);
//				layer.addChild(lb);
			}
		}

//		layer.scale.set(1.5);
		layer.position.set(this.width/2, this.height/2);

		var style1:DefaultStyle = {};
		style1.fill = 0xF78181;
		style1.fontSize = 18;
		style1.fontFamily = "Courier";
		_label1 = new Text("TEXT 1", style1);
		_label1.position.set(0, 0);
		stage.addChild(_label1);

		var style3 = {
			fontSize:"52px"
		};
		_label3 = new Text("TEXT 3");
		_label3.style = style3;
		_label3.position.set(0, 160);
		stage.addChild(_label3);





	}

	static function main() {
		new Main();
	}
}